<%--
 * Título: gestHora. Aplicación web de gestión de horarios para conservatorios.
 * Alumnos:
 * - Javier Pardo Muñoz. I.T. Informática de Gestión
 * - Antonio Prior Cazorla. I.T. Informática de Gestión
 * Director: Dr. José Raúl Romero Salguero.
 *     
 *  Copyright (C) 2013 Javier Pardo Muñoz / Antonio Prior Cazorla
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.

 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<jsp:useBean id="MsgBean" class="es.uco.gesthora.interfaz.MsgBean" scope="session"/>
<jsp:useBean id="UsuarioBean" class="es.uco.gesthora.interfaz.UsuarioBean" scope="session"/>


<html>

    <head>
        <link rel="stylesheet" type="text/css" href="/gestHora/css/general.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="icon" type="image/png" href="/gestHora/img/favicon.png" />

        <script type="text/javascript" src="/gestHora/js/jQuery.js"></script>   
        <script type="text/javascript" src="/gestHora/js/ajax/alumnos.js"></script> 
        <script type="text/javascript" src="/gestHora/js/menu.js"></script> 

        <script type="text/javascript">

            $(document).ready(function() {

                rellenarTablaHorarioAlumnoPropio('<%=UsuarioBean.getUsuario()%>');

                $('#generarPDF').click(function() {
                    generarPDFHorarioAlumno('<%=UsuarioBean.getUsuario()%>');
                });

            });


        </script>

        <title>gestHora: Consulta de horario</title>
    </head>



    <%
        String URL = "";

        /* Si el usuario está logueado permite entrar a la vista */
        if (UsuarioBean.getRol().equals("alumno")) {
    %>

    <body>

        <div class="contenedor">

            <jsp:include page="/jsp/views/header.jsp"/>

            <div class="contenido">
                <div class="contenido-dentro">                    
                    <div class="contenido-principal" role="main">

                        <jsp:include page="/jsp/views/menu.jsp"/>

                        <div id= "breadcumbs"  >

                            <a href="/gestHora/jsp/views/gestionUsuarioViewIndice.jsp">Inicio</a>
                            &#8594;
                            Consulta de horario


                        </div>

                        <section class="contenido-articulo">

                            <h2>Consulta de horario</h2>
                            <br/>
                            <% if (MsgBean.getMsg().equals("")) {%>
                            <p>Aquí puede ver su horario completo y guardarlo.</p>
                            <br/>

                            <div id="tabla"><table id='tablaView' class = 'tablaView'><thead><tr><th >Hora/Fecha</th><th>Lunes</th><th>Martes</th><th>Miércoles</th><th>Jueves</th><th>Viernes</th></tr></thead>
                                    <tbody>
                                        <tr><th>8:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>9:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>10:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>11:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>12:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>13:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>14:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>16:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>17:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>18:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>19:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                        <tr><th>20:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    </tbody>
                                </table></div>

                            <button id="generarPDF" class="botonPDF" name="generarPDF" value="generarPDF" type="button">Guardar como PDF</button>

                            <% } else {%>
                            <a class="volver" href="/gestHora/jsp/views/horarioAlumnoView.jsp"> &#8592; Volver atrás</a><br/>

                            <p><%=MsgBean.getMsg()%></p>                            


                            <% MsgBean.setMsg("");%>

                            <% }%>

                        </section>

                    </div>
                </div>

                <jsp:include page="/jsp/views/footer.jsp"/>

            </div>
        </div>

    </body>
</html>


<%} /* En caso de que el usuario no esté logueado muestra un mensaje de error */ else {
        MsgBean.setMsg("No tiene permisos para visualizar esta página. Inicie sesión con un usuario con privilegios.");
        URL = "/error.jsp";

        response.sendRedirect("/gestHora" + URL);

    }%>
